package com.lifp.controller;

import com.lifp.annotation.SysLogInfo;
import com.lifp.constant.CommonConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author lfp
 * @Date 2022/8/25
 * @Version 1.0
 */
@RestController
@RequestMapping("loginfo")
@Slf4j
public class SysLogInfoAnnoTestController {

    //不加注解
    @GetMapping("method")
    public void method(){
        log.info("======> 执行了无参方法 method()");
    }

    //无参方法，加注解
    @GetMapping("method1")
    @SysLogInfo("无参方法method1")
    public void method1(){
        log.info("======> 执行了无参方法 method1()");
    }


    //有参方法，加注解
    @GetMapping("method2")
    @SysLogInfo(value = "有参方法method2",logType = CommonConstant.LOG_TYPE_2)
    public void method2(@RequestParam("name") String name){
        log.info("======> 执行了方法:{},方法参数为：{}","method2()",name);
    }
}
